The user passes R code which defines the body of the function to be translated. Furthermore, the information of the types for the arguments passed to the function have to be defined.
In C++ an expression template library is used which has scalars, vectors and matrices which behave as much as possible as the corresponding R objects.
What happens in R
What happens in C++